﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Bigway.Common.Controllers;
using static CommonStatics;

[Route("")]
public class HomeController(ILogger<HomeController> logger)
{
    [HttpGet]
    public RedirectResult Index() => RedirectToScalar();

    [HttpGet("index.html")]
    public RedirectResult IndexHtml() => RedirectToScalar();

    [HttpGet("api")]
    public RedirectResult RedirectApi() => RedirectToScalar();

    private RedirectResult RedirectToScalar()
    {
        logger.LogInformation("Redirecting api page to scalar");
        return new RedirectResult(ScalarUrl);
    }
}